package com.tanhua.sso.server.controller;

import com.tanhua.sso.server.service.BaiDuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
@RequestMapping("baidu")
public class BaiDuController {

    @Autowired
    private BaiDuService baiDuService;

    /*上报地理位置*/
    @PostMapping("location")
    public ResponseEntity location(@RequestBody Map map){
        //获取纬度
        Number latitude = (Number) map.get("latitude");
        //获取经度
        Number longitude = (Number) map.get("longitude");
        //获取地理位置
        String addrStr = (String) map.get("addrStr");
        baiDuService.location(latitude,longitude,addrStr);
        return ResponseEntity.ok(null);
    }
}
